<template>
	<view class="Scan" @click="Sweep">
		<view class="iconfont icon-saoma white size28"></view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	import Api from '@/common/Api.js'
	export default {
		data() {
			return {}
		},
		methods: {
			...mapMutations(['getVid']),
			async Sweep() {
				const result = await Api.scanCode()
				if (result.type == 'getCharge') {
					this.getVid('')
					uni.reLaunch({
						url: `/Money/userMoney?id=${result.id}`,
					})
				}
			},
		},
	}
</script>

<style lang="scss" scoped>
	.Scan {
		width: 66rpx;
		height: 66rpx;
		background-color: #333;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>